using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Data;
using ConversaoSIC.DAL;

namespace ConversaoSIC.BRL
{
    public class ConversaoBRL
    {
        ConversaoDAL objDAL;
        public ConversaoBRL() { }
        
        public void ConverterDados(frmMaster frm)
        {
            CriaObjDA();
            try
            {
                objDAL.AtualizaParadox(frm);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public DataSet LerDados(string tabela)
        {
            CriaObjDA();
            try
            {
                return objDAL.LerTabela(tabela);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public void CarregaBanco()
        {
            DataSet ds = LerDados("SELECT * FROM MUNICIPIOS");
            DataTable dt = ds.Tables[0];
            foreach (DataRow dr in dt.Rows)
            {
            }
        }


        public void SetPathExcel(string path)
        {
            ConversaoDAL.sourceExcel = path;
        }

        public void SetPathParadox(string path)
        {
            ConversaoDAL.sourceParadox = path;
        }
        
        public void SetPathArqTexto(string path)
        {
            ConversaoDAL.sourceTexto = path;
        }

        private void CriaObjDA()
        {
            if (objDAL == null)
            {
                objDAL = new ConversaoDAL();
            }
        }

    }
}
